﻿namespace Vdc.Grid
{
    using System;
    using System.Web.UI;

    public class Library
    {
        public static string AccessibleLanguage(Page page, string path)
        {
            if (page != null)
            {
                foreach (string str3 in page.Request.ServerVariables["HTTP_ACCEPT_LANGUAGE"].ToLower().Replace(" ", "").Split(new char[] { ',' }))
                {
                    int index = str3.IndexOf(';');
                    string str2 = "";
                    if (index >= 0)
                    {
                        str2 = str3.Substring(0, index);
                    }
                    else str2 = str3;
                    try
                    {
                        new Localization(path, str2, page);
                        return str2;
                    }
                    catch
                    {
                    }
                }
            }
            return "en";
        }
    }
}

